#ifndef STATUSBARINFORMER_H
#define STATUSBARINFORMER_H

#include <QObject>
#include <QLabel>
#include <QString>
#include <QDebug>
#include <QStatusBar>
#include <QTimer>
#include <QTime>
#include <QAction>
#include "clientsdatabase.h"


class StatusBarInformer : public QObject
{
    Q_OBJECT

public:
    StatusBarInformer(QStatusBar *bar, ClientsDataBase *base);
    ~StatusBarInformer();

    void setUploadSpeedInfo(size_t speed);
    void setDownloadSpeedInfo(size_t speed);
    void setTotalUploadInfo(size_t size);
    void setTotalDownloadInfo(size_t size);

    quint64 currentUploadSpeed();
    quint64 currentDownloadSpeed();


signals:
    void uploading();
    void quiescentState();


public slots:
    void stopScan();
    void startScan();
    void update();
    void addTxRxValue(int tx, int rx);

private:
    void informeOfUploading(quint64 uSpeed);

private:
    QStatusBar *bar;
    ClientsDataBase *cbase;
    QTimer timer;
    QTime updTime;

    QLabel *upSpeed;
    QLabel *dSpeed;
    QLabel *totUpload;
    QLabel *totDownload;

    quint64 uSpeedi, dSpeedi, tUploadedi, tDownloadedi;
    bool flag_emit;
};

#endif // STATUSBARINFORMER_H
